package com.ssdp.controller;


import com.ssdp.dto.Result;
import com.ssdp.service.IFollowService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * @author syo 2319615164@qq.com
 * @description 关注和取关接口
 * @date 2024/3/14
 * @Copyright syo
 */
@RestController
@RequestMapping("/follow")
@Api(tags = "关注相关接口")
@RequiredArgsConstructor
public class FollowController {

    private final IFollowService followService;

    @PutMapping("/{id}/{isFollow}")
    @ApiOperation("关注和取关用户")
    public Result follow(@PathVariable("id") Long followUserId, @PathVariable("isFollow") Boolean isFollow) {
        return followService.follow(followUserId, isFollow);
    }

    @ApiOperation("是否关注用户")
    @GetMapping("/or/not/{id}")
    public Result isFollow(@PathVariable("id") Long followUserId) {
        return followService.isFollow(followUserId);
    }

    @ApiOperation("共同关注")
    @GetMapping("/common/{id}")
    public Result followCommons(@PathVariable("id") Long id) {
        return followService.followCommons(id);
    }
}
